package keyboard

import (
	"log"
	"os/exec"
	"time"
)

func SimulatePaste() {
	// 等待一小段时间确保剪贴板内容已经准备好
	time.Sleep(100 * time.Millisecond)

	// AppleScript 命令来模拟 Command+V
	script := `
		tell application "System Events"
			keystroke "v" using command down
		end tell
	`

	// 执行 AppleScript
	cmd := exec.Command("osascript", "-e", script)
	if err := cmd.Run(); err != nil {
		log.Printf("Failed to simulate paste: %v", err)
	}
}
